package fr.afcepf.ai89.esharing.entity;

import java.io.Serializable;
import javax.persistence.*;
import java.util.List;


/**
 * The persistent class for the fr_commune database table.
 * 
 */
@Entity
@Table(name="fr_commune")
@NamedQuery(name="FrCommune.findAll", query="SELECT f FROM FrCommune f")
public class FrCommune implements Serializable {
	private static final long serialVersionUID = 1L;

	@EmbeddedId
	private FrCommunePK id;

	@Column(name="EST_CHEF_LIEU_REGION")
	private byte estChefLieuRegion;

	@Column(name="EST_PREFECTURE_DEPT")
	private byte estPrefectureDept;

	@Column(name="NOM_COMMUNE")
	private String nomCommune;

	//bi-directional many-to-one association to FrCodePostalAsso
	@OneToMany(mappedBy="frCommune")
	private List<FrCodePostalAsso> frCodePostalAssos;

	//bi-directional many-to-one association to FrDepartement
	@ManyToOne
	@JoinColumn(name="ID_DEPARTEMENT", insertable=false, updatable=false)
	private FrDepartement frDepartement;

	public FrCommune() {
	}

	public FrCommunePK getId() {
		return this.id;
	}

	public void setId(FrCommunePK id) {
		this.id = id;
	}

	public byte getEstChefLieuRegion() {
		return this.estChefLieuRegion;
	}

	public void setEstChefLieuRegion(byte estChefLieuRegion) {
		this.estChefLieuRegion = estChefLieuRegion;
	}

	public byte getEstPrefectureDept() {
		return this.estPrefectureDept;
	}

	public void setEstPrefectureDept(byte estPrefectureDept) {
		this.estPrefectureDept = estPrefectureDept;
	}

	public String getNomCommune() {
		return this.nomCommune;
	}

	public void setNomCommune(String nomCommune) {
		this.nomCommune = nomCommune;
	}

	public List<FrCodePostalAsso> getFrCodePostalAssos() {
		return this.frCodePostalAssos;
	}

	public void setFrCodePostalAssos(List<FrCodePostalAsso> frCodePostalAssos) {
		this.frCodePostalAssos = frCodePostalAssos;
	}

	public FrCodePostalAsso addFrCodePostalAsso(FrCodePostalAsso frCodePostalAsso) {
		getFrCodePostalAssos().add(frCodePostalAsso);
		frCodePostalAsso.setFrCommune(this);

		return frCodePostalAsso;
	}

	public FrCodePostalAsso removeFrCodePostalAsso(FrCodePostalAsso frCodePostalAsso) {
		getFrCodePostalAssos().remove(frCodePostalAsso);
		frCodePostalAsso.setFrCommune(null);

		return frCodePostalAsso;
	}

	public FrDepartement getFrDepartement() {
		return this.frDepartement;
	}

	public void setFrDepartement(FrDepartement frDepartement) {
		this.frDepartement = frDepartement;
	}

}